import java.util.HashMap;

public class ResourceFactory {
    private HashMap<String, Resource> resourcePool = new HashMap<String, Resource>();

    public Resource getResource(String key) {
        Resource resource;

        if (resourcePool.containsKey(key)) {
            resource = resourcePool.get(key);
        } else {
            resource = new SpecificResource(key);
            resourcePool.put(key, resource);
        }

        return resource;
    }
}